#ifndef __BSP_SDMMC_H_
#define __BSP_SDMMC_H_

#ifdef __cplusplus
extern "C"
{
#endif

#include "system.h"



/* export func */

void bsp_sdmmc2_init(void);
void bsp_sdmmc2_deinit(void);

SD_HandleTypeDef *bsp_sdmmc2_get_handle(void);
void bsp_sdmmc2_lock(void);
void bsp_sdmmc2_unlock(void);

uint8_t bsp_sdmmc2_erase(uint32_t addr_start, uint32_t addr_end);
uint8_t bsp_sdmmc2_read(uint32_t addr, uint8_t *data, uint32_t size, uint32_t timeout);
uint8_t bsp_sdmmc2_write(uint32_t addr, uint8_t *data, uint32_t size, uint32_t timeout);
uint8_t bsp_sdmmc2_read_blocks_dma(uint32_t addr, uint32_t *data, uint32_t blocks);
uint8_t bsp_sdmmc2_write_blocks_dma(uint32_t addr, uint32_t *data,  uint32_t blocks);

uint32_t bsp_sdmmc2_get_card_state(void);

uint32_t bsp_sdmmc2_get_card_type(void);
uint32_t bsp_sdmmc2_get_card_version(void);
uint32_t bsp_sdmmc2_get_card_speed(void);
uint32_t bsp_sdmmc2_get_class(void);
uint32_t bsp_sdmmc2_get_card_addr(void);
uint32_t bsp_sdmmc2_get_block_nbr(void);
uint32_t bsp_sdmmc2_get_block_size(void);
uint32_t bsp_sdmmc2_get_block_logical_nbr(void);
uint32_t bsp_sdmmc2_get_block_logical_size(void);

uint8_t bsp_sdmmc2_get_manufacturer_id(void);
uint16_t bsp_sdmmc2_get_oem_appli_id(void);
uint32_t bsp_sdmmc2_get_prod_name_1(void);
uint8_t bsp_sdmmc2_get_prod_name_2(void);
uint8_t bsp_sdmmc2_get_prod_rev(void);
uint32_t bsp_sdmmc2_get_prod_sn(void);
uint16_t bsp_sdmmc2_get_manufact_date(void);

uint8_t bsp_sdmmc2_is_exist(void);


#ifdef __cplusplus
}
#endif

#endif // __BSP_SDMMC_H_
